const logout = document.querySelector('.logout');
const oneMenuList = document.querySelectorAll('.nav>li>a');
const twoMenuList = document.querySelectorAll('.nav ul a');
const init = document.querySelector('.init');
// 绑定点击事件
logout.addEventListener('click', function(e) {
    //点击退出-删除本地的token-跳转到登录页
    localStorage.removeItem('token');
    location.href = "./login.html";
})

oneMenuList.forEach(one => {
    one.addEventListener('click', function(e) {
        one.querySelector('.toggle').classList.toggle('toggleone')
        one.nextElementSibling.classList.toggle('show')
    })
})
twoMenuList.forEach(two => {
    two.addEventListener('click', function(e) {
        document.querySelector('.nav ul a.active').classList.remove('active');
        two.classList.add('active')
    })
})
init.addEventListener('click', function(e) {
    axios.get('/init/data').then(result => {
        if (result.data.code === 0) {
            toastr.success(result.data.message)
        }
    })
})